package logic

import (
	"context"
	"shop-login-sys/model/mysql"

	"shop-login-sys/shoprpc/internal/svc"
	"shop-login-sys/shoprpc/shoprpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type ProductListLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewProductListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ProductListLogic {
	return &ProductListLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *ProductListLogic) ProductList(in *shoprpc.ProductListRequest) (*shoprpc.ProductListResponse, error) {
	// todo: add your logic here and delete this line
	var list []*shoprpc.ProductList
	list = mysql.ProductList(mysql.DB, in, list)

	return &shoprpc.ProductListResponse{
		List: list,
	}, nil
}
